using System;
using FishFillets.Model;
using FishFillets.Model.GameItems;
using Microsoft.Xna.Framework;

namespace FishFillets.Data.Helpers
{
    public static class ItemScriptExtension
    {
        public static ILevelAgent agent { get; set; }

        #region ----- BaseItem LUA wrapper methods -----------------------

        public static bool isOut(this BaseItem item)
        {
            return item.Out;
        }

        public static bool isAlive(this BaseItem item)
        {
            return item.Alive;
        }

        public static bool isTalking(this BaseItem item)
        {
            return item.Talking;
        }

        public static string getAction(this Fish item)
        {
            switch (item.State)
            {
                case FishState.Rest:
                    return "rest";
                case FishState.Swam:
                    return "swam";
                case FishState.Talk:
                    return "talk";
                case FishState.Turn:
                    return "turn";
                case FishState.Vertical:
                    return "vertical";
                case FishState.Skeleton:
                    return "skeleton";
                default:
                    throw new ArgumentOutOfRangeException();
            }
        }

        #endregion

        public static void planDialog(this BaseItem item, long delay, string messageID)
        {
            agent.planDialog(delay, messageID, Color.SteelBlue);
        }

        public static void updateAnim(this Item item)
        {
            // TODO !
        }
    }
}
